﻿package part_06_Homework;

import java.util.Scanner;

/*
 * 	循环录入学生成绩，输入负数则退出
 */
public class Work_05 {

	public static void main(String[] args) {
		double avg;
		double sum= 0;
		boolean isNe = true;
		Scanner sc = new Scanner(System.in);
		System.out.print("请输入姓名：");
		String name = sc.next();
		for(int i=1;i<=10;i++){
			System.out.print("请输入第"+i+"门课程成绩：");
			double score = sc.nextDouble();
			if(score<0){
				isNe = false;
				System.out.println("输入错误，请核对后重新输入！");
				break;
			}sum += score;
		}
		if(isNe){
			avg = sum/10;
			System.out.println(name+"同学十门课程的平均分是："+avg);
		}
	}
}
